home *** CD-ROM | disk | FTP | other *** search
- Cover
- PC-CRYPT
-
- Data Encryption and Decryption Program
- Version 7.0 20 August 1993 Supercedes all prior versions
-
- Copyright 1993 by
- James T. Demberger
- 9862 Lake Seminole Drive West
- Seminole, FL 34643
- 813-397-2930
-
- PC-CRYPT is a user supported program. You are encouraged to
- copy and share this program with other users so long as the program is
- not distributed in modified form and this notice is not bypassed or
- removed.
-
- PC-CRYPT is NOT a public domain program. The program and
- documentation for PC-CRYPT may be freely copied for archive or working
- copies for personal non-profit use as outlined in copyright regulations.
- PC-CRYPT may be made available thru clubs or user groups, program
- libraries or on remote access data bases or bulletin boards.
-
- Disclaimer
-
- The PC-CRYPT program and associated documentation is provided on an
- "as is" basis without warranty of any kind, expressed or implied. Anyone
- using this software assumes all risks as to the quality and performance
- of the software. The author disclaims all liability for any special,
- incidental, consequential, direct or indirect damages due to either
- proper and improper use of the program.
-
- Table of Contents
-
- Introduction - - - - - - - - - - - - - - 1
- System Requirements - - - - - - - - - - - 1
- Vernam Encryption - - - - - - - - - - - - 1
- Functional Outline of PC-CRYPT - - - - - 2
- Keyword Input - - - - - - - - - - - - 2
- Random Number Generator - - - - - - - 2
- Keyfile Generation - - - - - - - - - - 3
- Encryption and Decryption - - - - - - 3
- Using Keyfiles as One-Time-Pads - - - 3
- Running PC-CRYPT from Menu - - - - - - - 4
- Select Keyword - - - - - - - - - - - - 4
- PC-CRYPT Menu - - - - - - - - - - - - 5
- Encrypt & Decrypt Test Strings - - - - 5
- Processing Disk Files - - - - - - - - 5
- Running PC-CRYPT from Command Line - - - 5
- Transmitting Encrypt Files - - - - - - - 6
- Double Encryption - - - - - - - - - - - - 6
- Keyword Security - - - - - - - - - - - - 7
- Are PC-CRYPT Encrypt Files Unbreakable? - 7
- Commercial User License - - - - - - - - - 7
- Pseudo Basic Code for PC-CRYPT - - - - - 8
- Miscellaneous Notes - - - - - - - - - - - 9
-
- Page 1
- Introduction
-
- The program has three main functions:
- a: Demonstration of the Vernam encryption and decryption process.
- b: Outline operation of program and algorithms used by the program.
- c: Encryption and decryption of disk files using Vernam encryption
- and decryption combined with use of random keyfiles.
-
- System Requirements
-
- The program requires an IBM computer or compatible running DOS with
- color or monochrome display and one or more disk drives. File storage
- space must be available equal to twice the size of the largest file to
- be encrypt or decrypt.
-
- Vernam Encryption
-
- In 1917, long before the age of electronic computers, Gilbert S.
- Vernam developed an encryption process for messages punched in paper
- tape using Baudot or five channel teletype code. He used the
- electro-mechanical equivalent of a logical exclusive OR operation (XOR)
- on each character code in a message tape and a corresponding random
- character code in a key tape to produce a third tape with the encrypt
- message. Decryption used the same process except that a tape with the
- encrypt message and a copy the key tape were XORed to produce the
- decrypt message. PC-CRYPT uses essentially the same process to encrypt
- and decrypt disk files. Each character in a clear text file is XORed
- with the corresponding character in a virtual file of random eight-bit
- codes to produce a cipher text file. The program uses the same virtual
- file to decrypt the cipher text file and produce a copy of the original
- clear text file.
-
- One problem with the original Vernam process related to the key
- tapes. For a secure system, the characters in the key tapes had to be
- in random order and the number of characters in a key tape had to exceed
- the number of characters in the message to be encrypt. A duplicate of
- key tapes had to furnished to anyone who needed to decrypt messages. The
- physical security of the miles of paper tape was another problem.
- PC-CRYPT can generate thousands of different virtual random keys with
- lengths of 14,457,349 bytes. There is no need to store these virtual
- keys since each of the virtual keys can be regenerated when required for
- decryption of cipher text files.
-
- The eXclusive OR function (XOR) performed by Vernam encryption and
- decryption used by PC-CRYPT is "blind" as to the data in the input file.
- Any input file is XORed to produce an output file. If a clear text file
- is used as the input file, a cipher text output file is created. If a
- cipher text file is used as the input file, a copy of the original clear
- text file is created.
- Page 2
- Functional Outline of PC-CRYPT
-
- The following four sections outline the functional operation of
- PC-CRYPT. The functional operation of the program in the form of pseudo
- Basic source code is shown on Pages 8 and 9. A reasonably proficient
- programmer, using this text and the pseudo source code, should be able
- to write a program in Basic or some other high level language that would
- have the same functionality as PC-CRYPT.
-
- Keyword Input
-
- PC-CRYPT uses a keyword input routine to read an eight character
- keyword or password. More than eight characters can be enter for the
- keyword, the excess characters are ignored. The keyword input code
- treats the first eight character entered as four hexadecimal characters.
- The first three pairs of characters are used to set values for the
- pointers used for keyfile generation and the fourth pair to set a value
- for a seed for the random number generator. The MOD function is used to
- reduce the maximum value for the pointers to 239 for the first pointer,
- to 241 for the second pointer and to 251 for the third pointer. The
- value for the seed for the random number generator ranges from 0 to 255.
-
- The keyword input code accepts characters other than the normal hex
- characters 0 thru 9 and A thru F however these other characters do not
- enter into the conversion to decimal values for the pairs of hex
- characters. The use of other than normal hex characters for the keyword
- can be used to "hide" the characters actually used as pointer values.
- For example, the Social Security Number 214-35-1234 converts to pointer
- numbers 34, 5, 54 and 0. ZIP code + four numbers might also be used
- to conceal the pointer numbers. The program has a display capability
- that can be used to analyze the conversion process for the hexadecimal
- codes to decimal values.
-
- Random Number Generator
-
- The random number generator used by PC-CRYPT is a pseudo random
- number generator that will create an array or string of 256 random
- numbers. The random numbers in each array range in value from 0 to 255
- with only one occurrence of each random number in each array. One unique
- array is created for each of the seed numbers from 0 to 255.
-
- Since this pseudo random generator uses only integer values for
- input and output, there is no precision problem such as would occur with
- random number generators that have fractional numbers as output. The
- compiled 8086/8088 machine code in the PC-CRYPT executable file works
- the same way and produces the same random array for the same seed number
- when run on a any computer system using a 80X86 processor.
- Page 3
- Keyfile Generation
-
- PC-CRYPT creates virtual random keyfiles. Each character of a
- keyfile is generated as required using three numbers from an array of
- 256 random numbers. Each of the virtual keyfiles may be as long as
- 14,457,349 bytes. The length is the result of recycling the random
- numbers in the random number array using three nested loops with
- counters that are reset to 1 after 239, 241 or 251 cycles. You might
- note that 14,457,349 is the least common multiple of the three prime
- numbers 239, 241 and 251.
-
- The initial counter or pointer settings are determined by three
- values calculated from the keyword. Keyfile generation start at the
- three random numbers pointed to by the initial pointer values. Since
- each of the initial pointer values in effect defines a different virtual
- keyfile, there are 14,457,349 potential keyfiles.
-
- A key character is a random number resulting from the XOR operation
- on the three random numbers in the random number array pointed to by the
- current value of the three pointers. If we were to assume that the
- random number in the first position of the random number array was a
- zero and that initial setting of each of the three array pointers was
- 1, the value of the key character would be a "natural" zero (as compared
- to a "calculated" zero that results from 1 XOR 2 XOR 3). Assuming
- further that there was no other occurrence of a zero in the random number
- array, the next "natural" zero (as opposed to a "calculated" zero) will
- not occur until the pointer values all have a value of 1. Key
- characters with "calculated" zero value will probably occur at random
- intervals during the keyfile generation.
-
- Again assuming that the initial values of the three pointers was 1,
- the pointer values will simultaneously return to 1 when the first
- pointer value has recycled thru the random number array 60,491 times,
- the second pointer value has recycled 59,989 times and the third pointer
- has recycled 57,599 times. This will occur after 14,457,349 key
- characters have been generated if the length of the clear text file is
- 14,457,349 bytes or longer in length.
-
- Encryption and Decryption
-
- Any file input/output method can be used to read the clear or
- cipher text input files and to write the cipher or clear text output
- files. The method used by PC-CRYPt reads sequential 512 byte blocks
- into a character string array and creates the encrypt or decrypt text in
- another 512 byte character string array. If the length of the input
- file is not a multiple of 512, a "short" or partial block is processed
- as the last block. Each sequential character of an input block is XORed
- with the next sequential key character from the virtual key file to
- produce the corresponding sequential character in the output string.
-
- Using Keyfiles as One-Time-Pads
-
- One-Time-Pad (OTP) encryption systems are considered unbreakable.
- A virtual keyfile generated by PC-CRYPT is in effect a OTP so long as
- the keyword used to generate the keyfile is never reused. In theory,
- Page 4
-
- someone with a copy of the program could try all of the keywords that
- might have been used and by looking at the decrypt output, eventually
- "find" the keyword that was used to encrypt the clear text. In
- practice, this "brute force" decryption would probably be totally
- impractical since the number of possible keywords is 3,701,081,344
- (239*241*251*256).
-
- Running PC-CRYPT from Menu
-
- From DOS ready key [dr:][\path\]PC-CRYPT then press the Enter key.
-
- A default option is shown for the response to most prompts
- displayed by the program. As an example, a prompt for a yes or no
- response will display "y/N". Press Enter to take the no default option
- indicated by the upper case N. Either a lower case y or an upper case Y
- must be pressed for the yes response. If only lower case options or no
- option is shown, an entry other than the Enter key must be used.
-
- The first two screens display information about the program. These
- displays are followed by the keyword entry display:
-
- SELECT KEYWORD
-
- Press Enter for No visible display of Keyword OR
- Press K for a visible display of Keyword only OR
- Press D for display of pointers and random numbers K
-
- Old Keyword is
-
- Enter new 8 character (hex) Keyword AaBbCcDd
-
- Press any key to continue _
-
- Press the Enter key for the no visible display of the keyword as it
- is being entered if you don't want someone looking over your shoulder to
- see the keyword. Press the K key to display both the currently selected
- keyword and the new keyword being entered. An error message will be
- displayed if less than eight characters were entered before the Enter
- key was pressed.
-
- Press the D key for a visible display of the keywords and a display
- of the hexadecimal and the decimal values for the loop pointers and
- random number seed and the numbers in the random number array. If both
- of the character in a pair are the characters 0 thru 9 and A thru F
- (either upper or lower case), the equivalent decimal value for the hex
- pair is displayed. If neither of the characters is a hex character, the
- conversion results in a decimal zero. Combinations of one hex character
- and one non-hex character may convert to a zero or some value from 0 to
- 15. The 256 random numbers generated using the seed for the random
- number generator are displayed on the next 13 lines.
- Page 5
- PC-CRYPT Menu
-
- K Select Keyword
- T Turn Timer On/Off
- S Encrypt & Decrypt Test Strings
- F Process Disk Files
- X Exit/End Program
-
- Enter Option Letter _
-
- Press K for the Select Keyword option if you wish to change the
- keyword originally entered during the initial Select Keyword display.
-
- Press T for a prompt to turn on or off a timer that will total
- number of characters encrypt or decrypt and the total time required.
- The total time is for encryption or decryption only and does not include
- time for reading and writing files. The program uses these totals to
- compute and display the thruput in characters per second.
-
- Encrypt & Decrypt Test Strings
-
- The Encrypt & Decrypt Test Strings option displays a submenu from
- which you may select four different types of character strings for
- encryption and decryption. The clear text, cipher text and decrypt text
- strings are displayed. This option is primarily used to look at the
- pattern of characters produced when you encrypt strings of upper case,
- lower case and numeric characters. Key board input of test records
- accepts ASCII codes entered with the Alt key and numeric keys. In some
- cases, a character may be encrypt as the same character. This is not an
- error; it demonstrates that the XOR function is really working as it
- should.
-
- Process Disk Files
-
- When you select this option the following prompts and message will
- be displayed:
-
- Enter Input [dr:][\path\]filename.ext
-
- Enter Output [dr:][\path\]filename.ext
-
- Processing ___ bytes
-
- A period (.) is printed as each 512 bytes of a file is processed.
- Total processing time and bytes per second is displayed if the timer
- option has been turned on.
-
- Running PC-CRYPT from Command Line
-
- If your only need is to encrypt or to decrypt existing files,
- PC-CRYPT may be run from the DOS command line by entering the
- keyword, the input filename and the output filename. A command
- line example follows:
-
- PC-CRYPT /KW=keyword /FI=dr:\path\fname.ext /FO=dr:\path\fname.ext
- Page 6
- The command line parameters must be entered in the order shown;
- /KW=keyword, /FI=filename for the file to be encrypt or the file
- to be decrypt, and /FO=filename for the encrypt file or the decrypt
- file. There is no output shown on the display nor is any other
- input required other than the parameters entered on the command line.
-
- Transmitting Encrypt Files
-
- An encrypt data file may be sent to another system for decryption
- using a communications link or as a disk file. Since encrypt data files
- may contain character strings corresponding to transmission control
- codes, encrypt files should be transmitted as eight bit binary files
- using XMODEM or some equivalent transmission protocol for binary files.
- File compression utilities will probably not compress encrypt files or
- only compress these files by a very small percentage.
-
- Double Encryption
-
- The cipher text produced with PC-CRYPT is probably unbreakable.
- However there is the possibility that a sufficiently fast and powerful
- computer using an automated brute force decryption system combined with
- some technique for clear text recognition might permit the decryption of
- a file. Double encryption can be implemented by encrypting a cipher
- text file a second time with a keyword different from that used for the
- first encryption. The same two keywords must be used to decrypt the
- double encrypt data. Use of any text recognition method is defeated by
- double encryption since there is no way to determine which of the many
- files produced by any attempt at decryption is really the target cipher
- file rather than a file of computer generated "garbage".
-
- As an alternative to using two passes for double encryption, the
- program could be modified to use two different keywords simultaneously.
- The XORed character output from the first keyword would be XORed with
- the key character generated from the second keyword.
-
- A much simpler double encryption system is possible thru the use of
- password protected compressed files. The widely used PKZIP/PKUNZIP
- compression utility programs can be used to prepare password protected
- files that are probably as secure as the files produced by PC-CRYPT. A
- second layer of encryption using PC-CRYPT is just additional insurance
- that the encryption is unbreakable. The short string of characters for
- the filename found in compressed files is not long enough to
- permit brute force decryption of an encrypt compressed file since the
- remainder of the compressed file looks like a string of random
- characters with no discernible pattern.
- Page 7
- Keyword Security
-
- The security of keywords or passwords is the most important factor
- in the use of private key encryption systems. In the case of PC-CRYPT,
- there is nothing secure about the form of a keyword - security comes
- from the fact that the four hexadecimal numbers represent 3,701,081,344
- usable keywords. Changing just one out of the four hex character by
- incrementing it by one on a daily basis will provide enough different
- keywords to last for eight months or more.
-
- There are many different method for distribution of keywords depending
- on the number of users that require knowledge of the keywords. Lists of
- keywords for use by different users can be distributed by means of an
- encrypt file for which each user has been furnished the initial keyword.
- I'll leave how to handle the distribution of the initial keyword up to
- to those who are going to make use of PC-CRYPT.
-
- Are PC-CRYPT Encrypt Files Unbreakable?
-
- The algorithm used by the pseudo random number generator and the
- method used to generate the 14,457,349 byte pseudo random keyfiles in
- PC-CRYPT are public knowledge. A PC-CRYPT cipher text file is breakable
- only in the sense that it is known that one of the 3,701,081,344
- possible keywords will decrypt the file. Had the "clear text" for a
- file been a cipher text file (double encryption), any brute force "try
- every possible keyword" attempt at decryption will produce millions of
- files of which none can be recognized as the "broken" cipher text file.
-
- Neither the array of 256 numbers used by the program nor the
- 14,457,349 byte keyfiles are truly random since two copies of the
- PC-CRYPT program will produce the same array of 256 numbers and the same
- keyfile when the same keyword is used. A cipher text file produced by
- the program is truly random so long as the clear text is not known. A
- clear text file known to have long strings of the space character or
- repeated strings of text will not produce any discernible pattern of
- characters in the cipher text file. In those cases where there is a
- need to encrypt a file longer than 14,457,349 bytes in length, there
- will be nothing discernible in the cipher text file to indicate the
- actual point where the keyfile is recycled.
-
- Cipher text files produced with Vernam encryption using a random
- keyfile with a length equal to or greater that the clear text to be
- encrypt are considered to unbreakable unless the keyfile is known.
- Cipher text files produced using a random One-Time-Pad keyfile for
- encryption are considered to be unbreakable so long as the random
- One-Time-Pad file is not reused. The cipher text files produced by the
- PC-CRYPT program meet the conditions required to be considered to be
- unbreakable for both Vernam and One-Time-Pad encryption.
-
- Commercial User License
-
- No registration or license is required for personal non-profit use
- of the PC-CRYPT program. A $25.00 license fee for commercial users has
- been set just to find out if there are honest commercial users who want
- to use the program instead of having house programmers write a
- functionally equivalent program.
- Page 8
- Pseudo Basic Code for PC-CRYPT
-
- The following pseudo Basic source code outlines keyword input
- processing, random number generation and XOR encryption of disk files.
- These are the three essential routines used by the PC-CRYPT to produce
- cipher text files and to decrypt cipher text files. I am not releasing
- the Basic source code for a variety of reasons, several of which are:
-
- a) The source code was written using PowerBASIC and it probably will
- require considerable modification before it will run using other
- more common dialects of Basic.
- b) The program contains a lot of testing and debugging code that is not
- relevant to the normal operation of the program.
- c) The program is written in unstructured "spaghetti" Basic code and I
- don't have the time to "clean it up" to the point where it would not
- invite negative comments regarding my profeciency as a programmer.
- d) Knowledge of the internal operation of the program is not required
- in order to evaluate the validity of the methods used file
- encryption and decryption. Users can write their own programs
- incorporating the following pseudo code with the assurance that
- the encryption methods used will produce unbreakable cipher text.
-
- rem Keyword Input
-
- rem Input is 8 hex(?) characters in variable Key.word$
-
- P.W1$ = MID$(Key.word$,1,2): P.W1$ = "&h" + P.W1$
- P.W2$ = MID$(Key.word$,3,2): P.W2$ = "&h" + P.W2$
- P.W3$ = MID$(Key.word$,5,2): P.W3$ = "&h" + P.W3$
- P.W4$ = MID$(Key.word$,7,2): P.W4$ = "&h" + P.W4$
-
- Point.1 = VAL (P.W1$) MOD 239 + 1
- Point.2 = VAL (P.W2$) MOD 241 + 1
- Point.3 = VAL (P.W3$) MOD 251 + 1
- Random.No.Pointer = VAL (P.W4$) MOD 256
-
- rem output is Point.1 = (1,2,....,238,239)
- rem Point.2 = (1,2,....,240,241)
- rem Point.3 = (1,2,....,250,251)
- rem Random.No.Pointer = (0,1,....,254,255)
-
- rem Random Number Generator
-
- rem start of loop to generate 256 pseudo random numbers
- SEED = Random.No.Pointer
- FOR INDEX = 1 TO 256
-
- rem next three statements generate pseudo random numbers
- rem that range in value from 0 to 255
- SEED = (SEED * 997) + 32771
- SEED = SEED - (INT (SEED / 32768) * 32768)
- SEED = FIX (SEED) MOD 256
-
- rem this line puts the random numbers in a 256 byte array Random.Nos
- Random.Nos (INDEX) = SEED
-
- rem end of loop to generate 256 pseudo random numbers
- NEXT INDEX
- Page 9
-
- rem Key File Generation and File Encryption and Decryption
-
- rem use LOF to determine number character in file to be processed
- Length.Input = LOF(INPUT.FILE)
- Main.Loop = 1
-
- Do While Main.Loop <= Length.Input
-
- rem code to read input characters from INPUT.FILE
- Input.Char = INPUT.FILE (Main.Loop)
-
- rem values for (Point.x) from Keyword Input
- rem Random.Nos array from Random Number Generator
- rem Key.Character created by XOR operation on three numbers from
- rem Random.Nos array
- rem next line continues (_) to second line following
- Key.Character = _
- Random.Nos(Point.1) XOR Random.Nos(Point.2) XOR Random.Nos(Point.3)
-
- rem increment counters and test for reset
- Point.1 = Point.1 + 1: IF Point.1 > 239 THEN Point.1 = 1
- Point.2 = Point.2 + 1: IF Point.2 > 241 THEN Point.2 = 1
- Point.3 = Point.3 + 1: IF Point.3 > 251 THEN Point.3 = 1
-
- rem Code to XOR input character with Key.Character goes here
- Output.Char = Input.Char XOR Key.Character
-
- rem Code to write output character to OUTPUT.FILE
- OUTPUT.FILE (Main.Loop) = Output.Char
-
- rem increment main loop counter
- Main.Loop = Main.Loop + 1
-
- DO END
-
- Miscellaneous Notes
-
- Cipher text files produced with Version 6 of PC-CRYPT use the same
- random number generator and XOR processing as Version 7 of PC-CRYPT
- however the keyword input processing is entirely different. Any archive
- type files encrypt with Version 6 should be decrypt and then reencrypt
- with Version 7.
-
- There are Federal Government regulations restricting the export of
- "encryption devices". I do not know if, under these regulations, the
- PC-CRYPT program would be classified as an "encryption device".
-
- The PC-CRYPT program uses the four hexidecimal values in the keyword
- to assign values to the three pointer and the random number seed in 1234
- order. Changing the order in which the four hexidecimal values are used
- to assign values to the three pointers and the random number seed can be
- used to create 23 additional variations of the program.
-
-
-
-